////////////////////////////////////////////////////////////////////////////////
//
//  FLYING KIWI BV
//  Copyright 2010 Flying Kiwi BV
//  All Rights Reserved.
//
//  NOTICE: Flying Kiwi permits you to use, modify, and distribute this file
//  in accordance with the terms of the license agreement accompanying it.
//
////////////////////////////////////////////////////////////////////////////////
package plantool.display.windows.objects {
	//--------------------------------------------------------------------------
	//  Imports
	//--------------------------------------------------------------------------
	import kiwi.components.Button;
	import kiwi.utils.Validation;
	
	import plantool.display.windows.BaseWindow;
	
	
	//--------------------------------------------------------------------------
	//  [Metadata (Events, Style, Effects etc)]
	//--------------------------------------------------------------------------
	
	//--------------------------------------------------------------------------
	//  Class declaration
	//--------------------------------------------------------------------------
	public class ButtonRow extends WindowRow {
		//--------------------------------------------------------------------------
		//Class constants
		//--------------------------------------------------------------------------
		
		//--------------------------------------------------------------------------
		//Class variables
		//--------------------------------------------------------------------------
		private var _buttonLeft:Button		= null;
		private var _buttonRight:Button		= null;
		
		//--------------------------------------------------------------------------
		//Class properties
		//--------------------------------------------------------------------------
		public function get buttonLeft():Button 	{ return _buttonLeft; }
		public function get buttonRight():Button 	{ return _buttonRight; }
		
		//--------------------------------------------------------------------------
		//Constructor and Destructor
		//--------------------------------------------------------------------------
		public function ButtonRow(window:BaseWindow) {
			super(window);
			
			//create buttons
			_buttonLeft 		= new Button();
			_buttonRight		= new Button();
			
			//override height
			height = 26;
		}
		
		public override function dispose():void {
			if (Validation.isSet(_buttonLeft)) {
				_buttonLeft.dispose();
				_buttonLeft = null;
			}
			
			if (Validation.isSet(_buttonLeft)) {
				_buttonRight.dispose();
				_buttonRight = null;
			}
			
			super.dispose();
		}
		
		//--------------------------------------------------------------------------
		//Class methods
		//--------------------------------------------------------------------------
		protected override function init():void {
			//super init
			super.init();
			
			//create buttons
			_buttonLeft.width 	= 100;
			_buttonLeft.height 	= 18;
			_buttonLeft.x		= 15;
			_buttonLeft.y		= (height - _buttonLeft.height) / 2;
			addChild(_buttonLeft);
			
			_buttonRight.width 	= 100;
			_buttonRight.height = 18;
			_buttonRight.x		= width - _buttonRight.width - 15;
			_buttonRight.y		= (height - _buttonRight.height) / 2;
			addChild(_buttonRight);
		}
	}
}